package com.kirayous.gulimall.third_part.controller;

import com.kirayous.common.utils.R;
import com.kirayous.gulimall.third_part.service.SmsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author KiraYous
 * @version V1.0
 * @Package com.kirayous.gulimall.third_part.controller
 * @date 2022/4/4 4:09
 */
@RestController
@RequestMapping("/sms")
public class SmsController {


    @Autowired
    SmsService smsService;

    /**
     * 提供给别的服务进行调用
     * @param phone
     * @param code
     * @return
     */
    @GetMapping("/sendcode")
    public R sendCode(@RequestParam("phone") String phone, @RequestParam("code") String code){
        System.out.println("third part send code");
        smsService.sendSmsCode(phone,code);
        return R.ok();
    }
}